package controller;

import model.Area;
import org.apache.commons.io.FileUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import java.io.*;
import java.util.HashMap;
import java.util.Map;

/**
 * Created by ZYT on 2015/6/29.
 */
@Controller()
@RequestMapping("/")
public class Areas {
    @RequestMapping("/index0.do")
    public ModelAndView  _main(@ModelAttribute("area") Area createBean){
        BufferedReader stdin= null;
        BufferedReader stdin1= null;
        Map map = new HashMap();
        Map map1 = new HashMap();
        String str = null;
        String str1 = null;
        try {
            stdin = new BufferedReader(new FileReader("C:\\Users\\ZYT\\Desktop\\num.txt"));
            stdin1 = new BufferedReader(new FileReader("C:\\Users\\ZYT\\Desktop\\name.txt"));
            for(int i=0;i<=20;i++){
                str = stdin.readLine();
                str1 = stdin1.readLine();
                map.put(str,str1);
                map1.put(str1,str);
                System.out.println(map);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
        ModelAndView modelAndView = new ModelAndView("area");
        modelAndView.addObject("area",map);
        modelAndView.addObject("area111",map1);
        modelAndView.addObject("area1",createBean);
        return modelAndView;
    }
}
